$.waiting = (function () {//等待提示
    if (window.youyuan && window.youyuan.showWaiting && window.youyuan.hideWaiting) {
        return {
            show: function (msg) {
                window.youyuan.showWaiting(msg);
            },
            hide: function () {
                window.youyuan.hideWaiting();
            }
        }
    } else {
        return {
            show: function (msg, val, btm) {
                if($('#waiting').length==0){
                    $('<div id="waiting" style="width:104px; height:82px; line-height:120px; background:rgba(0,0,0,0.5) url(../resources/images/loading.gif) center 14px no-repeat ; background-size: 20px;position:fixed; left:50%; top:150px; margin:-41px 0 0 -52px;  border-radius:10px;color:#fff; text-align:center;display:none;z-index:1000;"></div>').prependTo('body');
                }
                //
                if (val != null) {
                    if (btm == null) $('#waiting').css('top', val);
                    else {
                        $('#waiting').css("top", "auto");
                        $('#waiting').css("bottom", val);
                    }
                }
                //
                $('#waiting').html(msg).show();
            },
            hide: function () {
                $('#waiting').empty().hide();
            }
        }
    }
})();
$.tips = (function () {//等待提示
    if (window.youyuan && window.youyuan.toast) {
        return function (msg) {
            window.youyuan.toast(msg);
        };
    } else {
        return function (msg, val, btm) {
            if($('#tips').length==0){
                $('<div id="tips" style="width: 80%; word-wrap: break-word;word-break: break-all; padding:10px 0; overflow: hidden;background: rgba(0,0,0,0.5);border-radius: 10px;color: #fff;text-align: center;display: none;position: fixed;top: 50%;left: 10%;z-index: 1000;border:1px solid #fff"></div>').prependTo('body');
            }
            //
            if (val != null) {
                if (btm == null) $('#tips').css('top', val);
                else {
                    $('#tips').css("top", "auto");
                    $('#tips').css("bottom", val);
                }
            }
            //
            $('#tips').html(msg).show();
            setTimeout(function () {
                $('#tips').empty().hide();
            }, 2000);
        }
    }
})();